Imports DirectShowLib
Imports DevExpress.XtraEditors.Controls

Public Class FormSettingCamera
    Inherits PageTemplate
    Dim devicelist As DsDevice()
    Dim VIDEODEVICE As Integer

    Private Sub setcombodevice()
        VIDEODEVICE = My.Settings.DentalCamera
        devicelist = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice)
        'cboCamera. .Items.Clear()
        Dim coll As ComboBoxItemCollection = cboCamera.Properties.Items
        For Each d As DsDevice In devicelist
            coll.Add(d.Name)
        Next
        cboCamera.SelectedIndex = VIDEODEVICE
    End Sub

    Private Sub FormSettingCamera_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        setcombodevice()
    End Sub

    Private Sub SimpleButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton1.Click
        Try
            My.Settings.DentalCamera = cboCamera.SelectedIndex
            My.Settings.Save()
            MsgBox("Execute Success", MsgBoxStyle.Information, "Success")
        Catch ex As Exception
            MsgBox(e.ToString, MsgBoxStyle.Critical, "Error")
        End Try

    End Sub
End Class
